<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <input v-model="message1" placeholder="edit me" />
        <p>Message is: {{ message1 }}</p>

        <hr>

        <span>Multiline message is:</span>
        <p style="white-space: pre-line;">{{ message2 }}</p>
        <br />
        <textarea v-model="message2" placeholder="add multiple lines"></textarea>

        <hr>

        <input type="checkbox" id="checkbox" v-model="checked" /> 男
        <label for="checkbox">{{ checked }}</label>

        <hr>

        <div id="v-model-multiple-checkboxes">
            <input type="checkbox" id="jack" value="Jack" v-model="checkedNames" />
            <label for="jack">Jack</label>
            <input type="checkbox" id="john" value="John" v-model="checkedNames" />
            <label for="john">John</label>
            <input type="checkbox" id="mike" value="Mike" v-model="checkedNames" />
            <label for="mike">Mike</label>
            <br />
            <span>Checked names: {{ checkedNames }}</span>
        </div>

        <hr>
        <!-- 单选框的分组是靠v-model分组决定的 -->
        <div id="v-model-radiobutton">
            <input type="radio" id="one" value="One" v-model="picked" />
            <label for="one">One</label>
            <br />
            <input type="radio" id="two" value="Two" v-model="picked" />
            <label for="two">Two</label>
            <br />
            <span>Picked: {{ picked }}</span>
        </div>

        <hr>

        <div id="v-model-select" class="demo">
            <select v-model="selected">
                <option disabled value="">Please select one</option>
                <option value="bind A">A</option>
                <option value="bind B">B</option>
                <option>C</option>
                <!-- 有value就绑定value的值 -->
            </select>
            <span>Selected: {{ selected }}</span>
        </div>

        <hr>
        <!-- 修饰符 -->
        <!-- .lazy 当失去焦点时，才会改变 -->
        <input v-model.lazy="msg" />{{ msg }}<br>

        <!-- .number -->
        <input v-model.number="msg" />{{ msg }}<br>

        <!-- .trim 去两端空格 -->
        <input v-model.trim="msg" />{{ msg }}<br>



    </div>
    <script src="https://unpkg.com/vue@next"></script>
    <script>
        const App = {
            data() {
                return {
                    msg: null,
                    message1: null,
                    message2: null,
                    checked: false,
                    checkedNames: [],
                    picked: '',
                    selected: '',
                }
            },
            mounted() {

            },
            methods: {

            }
        }
        Vue.createApp(App).mount("#app")
    </script>
</body>

</html>